/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package extension.tan.handler;

import com.smartfoxserver.v2.entities.User;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.extensions.BaseClientRequestHandler;
import extension.game.room.RoomExtension;
import extension.room.tan.TanGame;
import extension.room.tan.TanPlayer;

/**
 *
 * @author daz
 */
public class EnFoldCardHandler extends BaseClientRequestHandler {

    @Override
    public void handleClientRequest(User user, ISFSObject params) {
        RoomExtension ext = (RoomExtension) getParentExtension();
        TanGame game = (TanGame) ext.getGame();
        TanPlayer p = game.getPlayerFight();
        if (p.getUser().getName().equals(user.getName())) {
            for (Integer cardAdd : game.getListCardOnTable()) {
                p.addCard(cardAdd);
            }
            game.findNextAttack();
            game.nextTurn();
        }
    }
}
